/**
 * futures : masterlink.futures.interceptor.HibernateInterceptor.java
 */
package masterlink.futures.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import masterlink.futures.util.WebUtils;
import masterlink.futures.vo.Employee;

import org.slf4j.Logger;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import baytony.util.log.Log;

/**
 * TODO Write the description
 *
 * @author : tonyyang
 * Create date : 2011/10/25
 * @version 1.0.0	
 */
public class AuthInterceptor extends HandlerInterceptorAdapter {
	
	private static Logger log=Log.getLogger(AuthInterceptor.class);
	
	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		Employee emp=WebUtils.getLogEmployee(request);
		return true;
	}
	
	
	@Override
	public void afterCompletion(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception ex)
			throws Exception {
		if(ex!=null){
			log.error(ex.toString());
			Log.logStackTrace(log, ex);
		}
		super.afterCompletion(request, response, handler, ex);
	}
	
}
